home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / SYS / IFFILE / _files / iffile_doc < prev    next >
Text File  |  1991-04-24  |  785b  |  30 lines

  1.  
  2. Here is yet another useful utility, infact about six utilities but the source
  3. to them is very similar.  This code is for IfFile, which executes the command
  4. tail if the first parameter if a file that exists.  You can change this to test
  5. for directories or the absence of the named object.
  6.  
  7. (As before, assemble and save as a utility (&FFC)).
  8.  
  9.  MOV   R8,R1
  10. .loop
  11.  LDRB  R0,[R8],#1
  12.  CMP   R0,#32
  13.  BHI   loop
  14.  MOV   R0,#0
  15.  STRB  R0,[R8,#-1]
  16.  MOV   R0,#5
  17.  SWI   "XOS_File"
  18.  MOVVS PC,R14
  19. .fix
  20.  CMP   R0,#1        ; 0 for IfNoFile, 2 for IfDir
  21.  MOV   R0,R8
  22.  SWIEQ "XOS_CLI"    ; NE for not
  23.  MOV   PC,R14
  24.  
  25. Share and enjoy...
  26.  
  27. Nicko
  28. +-----------------------------------------------------------------------------+
  29. | Nicko van Someren, nbvs@cl.cam.ac.uk, (44) 223 358707 or (44) 860 498903    |
  30.